Results 1 to 6 of 6

Thread: huddraw_virtualsize problem

  1. #1
    Testing Crew Member bulldozer's Avatar
    Join Date
    May 2010
    Location
    Hungary
    Posts
    261

    Default huddraw_virtualsize problem

    I'd like to make widescreen menus/textures for mohaa, but ran into a problem with the hud:

    Code:
    huddraw_virtualsize <index> <virtual> 
    This let’s you set the huddraw element’s size and position according to a  virtual screen resolution of 640x480. What this means is that it lets  you treat the hud like it’s always at 640x480, and it will be properly  resized and positioned according to the actual resolution.
    from Bdbodger on TMT:
    virtualsize does not changes the location with different video resolution settings it is the opposite virtualsize make all displays a virtual 640x480 display so your rect coords show on all displays with different video resolution the same . The trouble with that is usually the font size gets really big and if you don't use it then the hud is in a different place with different resolution
    Which file should be edited to change that 640x480 value to 1920x1080?

  2. #2
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    This is hard-coded behaviour because that is how virtualsize works. It treats each resolution as 640x480 so we can just design the HUD for such a screen.
    If the actual resolution is larger, the game will auto-scale everything for us. Why 640x480? Because it is the smallest screen resolution that the game supports
    and back in those days, it was still pretty common.

    Changing this defeats the entire purpose of virtualsize because if you set it to 1920x1080 then you basically screwed over all the people with smaller resolutions.
    Why? Because placing a backpack inside a building is easy compared to placing a building inside a backpack, metaphorically speaking. Scaling all the visual information
    on a 1920x1080 screen to anything less will inevitably incur information loss.

    Virtualsize actually has nothing to do with the aspect ratio. 1920x1080 has a widescreen 16:9 aspect ratio but so does 640x360. There's a 'r_customaspect' cvar which
    is used along with 'r_customwidth' and 'r_customheight' if 'r_mode' is -1. Not sure how or if it works. Default it seems to be set to 1. So I'd try 2, 3 etc..
    Last edited by Sor; January 27th, 2014 at 08:07 AM.
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  3. #3
    Testing Crew Member bulldozer's Avatar
    Join Date
    May 2010
    Location
    Hungary
    Posts
    261

    Default

    Virtualsize should be defined by a cvar then. I use 'r_customwidth 1920' and 'r_customheight 1080' with 'r_mode -1', but 'r_customaspect' does nothing.

  4. #4
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    Hm, well, it was worth a shot. But as far as I know you can't change how virtualsize works.

    If you need 'widescreen' textures with huddraw, make sure the width and height of the texture has a 'widescreen' ratio.
    For example, 640 / 360 equals 16 / 9.
    Code:
    huddraw_shader 20 "textures/black.tga" // or something
    huddraw_align 20 "center" "center"
    huddraw_rect 20 0 0 640 360
    Virtualsize should still be able to scale it without changing the ratio.
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  5. #5
    Testing Crew Member bulldozer's Avatar
    Join Date
    May 2010
    Location
    Hungary
    Posts
    261

    Default

    I've been working on the widescreen version of credits.

    Code:
    //*** text telling the player how to skip the credits
    huddraw_virtualsize 255 1
    huddraw_string 255 "Press FIRE to skip the credits"
    huddraw_align 255 left top
    huddraw_font 255 handle-22
    huddraw_color 255 1 1 1
    huddraw_rect 255 205 450 0 0
    If I set virtualsize to 0 the font size is ok & sharp in 1920x1080 resolution, but text position changes. If virtualsize remains 1, then this text gets bigger and blurry.

  6. #6
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    Unfortunately, that's how scaling works.

    Imagine a small image 192x108 and enlarging it by factor 10 to 1920x1080. The same blurring will happen because
    what was displayed as 1 pixel on the original image has to be displayed using 10 pixels on the enlarged image.

    In other words, the data of the images are the same but it has to be interpolated 10 times for the enlarged image
    to be displayed properly. If this didn't happen then the enlarged image would look like each pixel from the original
    image is spread out surrounded by a black void (as if it were a grid with very small coloured cells and huge black borders).
    Last edited by Sor; June 7th, 2015 at 06:41 AM.
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •